//
//  UIImageView+Extension.swift
//  微博Demo
//
//  Created by 花化华 on 2016/11/27.
//  Copyright © 2016年 itcast. All rights reserved.
//

import Foundation
import SDWebImage

extension UIImageView {
    /// 传imageName初始化一个imageView
    ///
    /// - Parameter imageName: 图片的名字
    convenience init(imageName: String) {
        self.init()
        self.image = UIImage(named: imageName)
    }
}

extension UIImageView {
    func wb_setImageWith(urlStr: String, placeHolder: String?) {
        if let url = URL(string: urlStr) {
            if let placeHolder = placeHolder {
                sd_setImage(with: url, placeholderImage: UIImage(named: placeHolder))
            }else {
                sd_setImage(with: url)
            }
        }
    }
}
